//
//  CustomDirectiveView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/25.
//

#import "CustomDirectiveView.h"

@implementation CustomDirectiveView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUI];
    }
    return self;
}
-(void)CreateUI{

    UIView *backV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, APPheight)];
    backV.backgroundColor = [UIColor whiteColor];
    [self addSubview:backV];
    
    UIView *titleLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    titleLine.backgroundColor = rgba(22, 120, 255, 1);
    titleLine.layer.cornerRadius = 2;
    [backV addSubview:titleLine];
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(titleLine.frame.size.width+titleLine.frame.origin.x+5,15, 70, 15)];
    titleLab.text = @"标题";
    titleLab.textColor = [UIColor blackColor];
    titleLab.textAlignment = 0;
    titleLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:titleLab];


    
    UITextField *txtf = [[UITextField alloc]initWithFrame:CGRectMake(15, titleLab.frame.size.height+titleLab.frame.origin.y+10, APPwidth-30, 40)];
    txtf.textColor = rgba(153, 153, 153, 1);
    txtf.placeholder = @"请输入标题";
    txtf.font = [UIFont systemFontOfSize:14];
    txtf.textAlignment = 0;
    [backV addSubview:txtf];
   
    
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0,txtf.height+txtf.y+15, APPwidth, 10)];
    line.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:line];

    
    UIView *playcontentline = [[UIView alloc]initWithFrame:CGRectMake(15, line.height+line.y+15, 3, 15)];
    playcontentline.backgroundColor = rgba(22, 120, 255, 1);
    playcontentline.layer.cornerRadius = 2;
    [backV addSubview:playcontentline];
    UILabel *playcontentLab = [[UILabel alloc]initWithFrame:CGRectMake(playcontentline.frame.size.width+playcontentline.frame.origin.x+5,line.height+line.y+15, 70, 15)];
    playcontentLab.text = @"播报内容";
    playcontentLab.textColor = [UIColor blackColor];
    playcontentLab.textAlignment = 0;
    playcontentLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:playcontentLab];
    
    UIButton *audition = [[UIButton alloc]initWithFrame:CGRectMake(APPwidth-120,line.height+line.y+15, 100, 20)];
    [audition setTitle:@"试听" forState:0];
    audition.contentHorizontalAlignment = 2;
    [audition setTitleColor:rgba(22, 120, 255, 1) forState:0];
    audition.titleLabel.font = [UIFont systemFontOfSize:14];
    //    bmBtn.imageEdgeInsets = UIEdgeInsetsMake(10, 13, 7, 62);
    //    [bmBtn.imageView setContentMode:UIViewContentModeScaleAspectFit];
    //    bmBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 13, 0, 0);
    [backV addSubview:audition];
    
    
    
    
    UITextView *txtv = [[UITextView alloc]initWithFrame:CGRectMake(15, playcontentLab.height + playcontentLab.y+15, APPwidth-30, 150)];
    txtv.text = @"请输入播报内容";
    txtv.layer.cornerRadius = 8;
    txtv.backgroundColor = rgba(245, 246, 249, 1);
    [backV addSubview:txtv];
    
    
    UIView *line1 = [[UIView alloc]initWithFrame:CGRectMake(0,txtv.height+txtv.y+10, APPwidth, 10)];
    line1.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:line1];
    
    
    UIView *otherline = [[UIView alloc]initWithFrame:CGRectMake(15, line1.y+line1.height+ 15, 3, 15)];
    otherline.backgroundColor = rgba(22, 120, 255, 1);
    otherline.layer.cornerRadius = 2;
    [backV addSubview:otherline];
    UILabel *otherlab = [[UILabel alloc]initWithFrame:CGRectMake(otherline.frame.size.width+otherline.frame.origin.x+5,line1.y+line1.height+ 15, 70, 15)];
    otherlab.text = @"其它";
    otherlab.textColor = [UIColor blackColor];
    otherlab.textAlignment = 0;
    otherlab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:otherlab];
    
    NSArray *pingpanLabarr = @[@"评判标准",@"随机播报序号"];
    NSArray *typeLabarr = @[@"不评判",@"随机播报"];

    for (int i = 0; i < pingpanLabarr.count; i++) {
        UILabel *pingpanlab = [[UILabel alloc]initWithFrame:CGRectMake(15,  otherlab.frame.size.height + otherlab.frame.origin.y+15+i*50, APPwidth-30, 50)];
        pingpanlab.text = pingpanLabarr[i];
        pingpanlab.textColor = rgba(51, 51, 51, 1);
        pingpanlab.textAlignment = 0;
        pingpanlab.font = [UIFont systemFontOfSize:16];
        [backV addSubview:pingpanlab];
        
        UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, pingpanlab.height-1, pingpanlab.width, 1)];
        line.backgroundColor = rgba(245, 245, 250, 1);
        [pingpanlab addSubview:line];
        
        UILabel *typeLab = [[UILabel alloc]initWithFrame:CGRectMake(pingpanlab.width-130,  otherlab.frame.size.height + otherlab.frame.origin.y+15+i*50, 120, 50)];
        typeLab.text = typeLabarr[i];
        typeLab.textColor = rgba(51, 51, 51, 1);
        typeLab.textAlignment = 2;
        typeLab.font = [UIFont systemFontOfSize:16];
        [backV addSubview:typeLab];
        
    }
    
    UIButton *bmBtn = [[UIButton alloc]initWithFrame:CGRectMake(APPwidth/2-328/2,APPheight-200, 328, 45)];
    [bmBtn setTitle:@"随机播报" forState:0];
    [bmBtn setBackgroundColor:rgba(22, 120, 255, 1)];
    bmBtn.contentHorizontalAlignment = 0;
    [bmBtn setTitleColor:[UIColor whiteColor] forState:0];
    bmBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    bmBtn.layer.cornerRadius = 45/2;
    [backV addSubview:bmBtn];
    
}

@end
